package org.come.control;

import java.math.BigDecimal;
import java.util.Map;

import org.come.Frame.ZhuFrame;
import org.come.action.FromServerAction;
import org.come.bean.ConfigureBean;
import org.come.model.Configure;
import org.come.xingpan.JpanelXingCardMain;
import org.come.xingpan.JframeXingCardMain;
import org.come.xingpan.JpanelXingBackMain;
import org.come.xingpan.JframeXingBackMain;
import org.come.until.FormsManagement;
import org.come.until.UserMessUntil;

public class PromptControl implements FromServerAction {

	@Override
	public void controlMessFromServer(String mes, String type) {
		// TODO Auto-generated method stub
		// String v=mes.split("//")[1];
		ConfigureBean allConfigure = UserMessUntil.getConfigureBean();
		Map<BigDecimal, Configure> item = allConfigure.getAllConfigure();
		Configure configure = item.get(new BigDecimal(1));
		if("1".equals(configure.getSfdkms())) {
			if (mes.contains("您的游戏点数不足请及时补充！当前点数")){
				dkbz();
			}
		}
		ZhuFrame.getZhuJpanel().addPrompt2(mes);

		if(FormsManagement.getInternalForm2(122)!=null){
			JpanelXingCardMain skillMainPanel = JframeXingCardMain.getJframeSummonEquipMain().getJpanelXingCardMain();
			skillMainPanel.changeBigMenuLeftView1(skillMainPanel.getBigType());
		}
		if(FormsManagement.getInternalForm2(121)!=null){
			JpanelXingBackMain skillMainPanel = JframeXingBackMain.getJframeSummonEquipMain().getJpanelXingBackMain();
			skillMainPanel.viewCultivateBtn();
		}
	}
    public static void dkbz(){
    	new Thread(new Runnable() {
			@Override
			public void run() {
				try {
					ZhuFrame.getZhuJpanel().addPrompt2("您的游戏点数不足，5秒后退出游戏！请及时补充！！！");
				} catch (Exception e) {
					// TODO: handle exception
				}
				try {
					Thread.sleep(5000);
					System.exit(0);
				} catch (Exception e) {
					// TODO: handle exception
				}
			}
		}).start();
    }
}
